<?
if (!defined('SMF'))
	die('Hacking attempt...');
	
global $smcFunc, $txt, $scripturl, $user_info;
global $dbtables;

// Verify user login, if CheckLogin() returns false return to the calling script/function
if (CheckLogin() == false)
	return;

bigtitle($txt['bnt_die_title']);

//-------------------------------------------------------------------------------------------------

// Pull player info into $playerinfo.
$result = $smcFunc['db_query']('', '
	SELECT *
	FROM {raw:db_ships}
	WHERE user_id = {int:user_id}
	LIMIT 1',
	array(
		'db_ships' => $dbtables['ships'],
		'user_id' => $user_info['id'],
	)
);
$playerinfo = $smcFunc['db_fetch_assoc']($result);
$smcFunc['db_free_result']($result);

$sure = (isset($_GET['sure'])) ? $_GET['sure'] : '';

if (empty($sure))
{
	echo '
		<font color="red"><b>', $txt['bnt_die_rusure'], '</b></font><br><br>
		<a href="', $scripturl, '?action=blacknova;sa=main">', $txt['bnt_die_nonono'], '</a> ', $txt['bnt_die_what'], '<br><br>
		<a href="', $scripturl, '?action=blacknova;sa=self_destruct;sure=1">', $txt['bnt_yes'], '!</a> ', $txt['bnt_die_goodbye'], '<br><br>';
}
elseif ($sure == 1)
{
	echo '
		<font color="red"><b>', $txt['bnt_die_check'], '</b></font><br><br>
		<a href="', $scripturl, '?action=blacknova;sa=main">', $txt['bnt_die_nonono'], '</a> ', $txt['bnt_die_what'], '<br><br>
		<a href="', $scripturl, '?action=blacknova;sa=self_destruct;sure=2">', $txt['bnt_yes'], '!</a> ', $txt['bnt_die_goodbye'], '<br><br>';
}
elseif ($sure == 2)
{
	echo '<p>', $txt['bnt_die_count'], '</p>';
	echo '<p>', $txt['bnt_die_vapor'], '</p>';
	$txt['bnt_login_newlife'] = str_replace("[scripturl]", $scripturl, $txt['bnt_login_newlife']);
	echo '<p>', $txt['bnt_login_newlife'], '</p>';
	db_kill_player($playerinfo['ship_id']);
	cancel_bounty($playerinfo['ship_id']);
	adminlog(LOG_ADMIN_HARAKIRI, "$playerinfo[character_name]|$_SERVER[REMOTE_ADDR]");
	playerlog($playerinfo['ship_id'], LOG_HARAKIRI, "$_SERVER[REMOTE_ADDR]");
}
else
	echo $txt['bnt_die_exploit'], '<br><br>';

if ($sure != 2)
	TextMainMenu();
?>
